﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xinkui.WebModel.BasicControl;
using Xinkui.WebModel.Data;
using Xinkui.WebModel.Cache;

public partial class UserControl_ShowRoom_UC_Right_ProductTop : ShowRoomControl {
    protected void Page_Load(object sender, EventArgs e) {

        var query = ShowRoomQueryData.Create();
        if (query.CategoryLevel1 > 0 && query.CategoryLevel2 > 0) {
            var categorys = CategoryCache.ListCategoryByCompany(this.BasePage.ShowRoomIdentity);

            var leve1 = categorys.FirstOrDefault(u => u.CategoryInfo.CategoryID == query.CategoryLevel1);
            if (leve1 != null) {
                var level2 = leve1.SubViews.FirstOrDefault(u => u.CategoryInfo.CategoryID == query.CategoryLevel2);
                this.rptCategorySource.DataSource = level2.SubViews;
                this.rptCategorySource.DataBind();
                return;
            }
        }

        this.Visible = false;


    }
}